package com.magold.logic.region.airflow;

import org.andengine.entity.particle.emitter.IParticleEmitter;
import org.andengine.entity.shape.IAreaShape;

public class AirflowParticleEmitter implements IParticleEmitter {
	private IAreaShape mRangeShape;
	private float mParticleWidth;
	private float mPrevX;
	
	public AirflowParticleEmitter(IAreaShape pRangeShape, float pParticleWidth) {
		mRangeShape = pRangeShape;
		mParticleWidth = pParticleWidth;
	}

	@Override
	public void onUpdate(float pSecondsElapsed) {
	}

	@Override
	public void reset() {
	}

	@Override
	public void getPositionOffset(float[] pOffset) {
		pOffset[0] = (mPrevX += mParticleWidth) % mRangeShape.getWidth();
		pOffset[1] = mRangeShape.getHeight();
		
		float[] buf = mRangeShape.convertLocalToSceneCoordinates(pOffset);
		pOffset[0] = buf[0];
		pOffset[1] = buf[1];
	}

}
